package com.tencent.sr.iris.activity.restapi.task;

import com.tencent.sr.iris.activity.dependency.qufa.GroupTaskDependency;
import com.tencent.sr.iris.activity.interfaces.request.acticity.QuFaUserHasJoinNormalPromoteRequest;
import com.tencent.sr.iris.activity.interfaces.request.task.*;
import com.tencent.sr.iris.activity.interfaces.response.group.task.*;
import com.tencent.sr.iris.activity.service.config.SceneConfig;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import com.tencent.sr.rmall.common.response.PaginationResponse;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "团长任务", value = "团长任务相关接口")
@RestController
@RequestMapping(value = {"/api/v1/iris/iris-activity-core-service/qufa"})
public class QuFaTestController {

    @Resource
    private GroupTaskDependency groupTaskDependency;

    @Resource
    private SceneConfig sceneConfig;

    public HttpResult<String> hello() {
        return HttpResult.succ("hello");
    }


    @PostMapping("/checkHasJoinNormalPromote")
    public QuFaUserHasJoinNormalPromoteRes checkHasJoinNormalPromote(
            @RequestBody @Validated QuFaUserHasJoinNormalPromoteRequest baseRequest) {
        QuFaUserHasJoinNormalPromoteRes quFaUserHasJoinNormalPromoteRes =
                groupTaskDependency.checkHasJoinNormalPromote(baseRequest);
        return quFaUserHasJoinNormalPromoteRes;
    }

    @PostMapping("/awardSend")
    public QuFaAwardSendRes awardSend(@RequestBody @Validated RewardSendRequest quFaReq) {
        return groupTaskDependency.awardSend(quFaReq, sceneConfig.getSceneInfoByScene(quFaReq.getTransactionFlag()));
    }

    @PostMapping("/getAwardInfo")
    public QuFaAwardInfoRes getAwardInfo(@RequestBody @Validated AwardInfoRequest quFaReq) {
        return groupTaskDependency.getAwardInfo(quFaReq, sceneConfig.getSceneInfoByScene(quFaReq.getTransactionFlag()));
    }


    @PostMapping("/shareVisit")
    public List<QuFaUserShareRes> shareVisit(@RequestBody @Validated UserShareRequest baseRequest) {
        List<QuFaUserShareRes> resp =
                groupTaskDependency.queryUsersShareVisit(baseRequest);
        return resp;
    }

    @PostMapping("/personalPerformanceList")
    public PaginationResponse<QuFaPerformancePersonalRes> personalPerformanceList(
            @RequestBody @Validated PersonalPerformanceReq req) {
        PaginationResponse<QuFaPerformancePersonalRes> resp =
                groupTaskDependency.personalPerformanceList(req);
        return resp;
    }

    @PostMapping("/queryUserPaymentInfo")
    public UserPaymentResponse queryUserPaymentInfo(@RequestBody @Validated UserRequest request) {
        return groupTaskDependency.queryUserPaymentInfo(request);
    }

    @PostMapping("/queryOpenId")
    public QueryOpenIdResponse queryOpenId(@RequestBody @Validated QueryOpenIdRequest request) {
        return groupTaskDependency.queryOpenId(request);
    }
}
